import {App} from "../App";
import {buildShader} from "../../../../src/utils";
import {Shader} from "../Shader";

const line_vs = `
precision mediump float;

attribute vec3 a_position;
uniform mat4 u_projMatrix;
uniform mat4 u_vmMatrix;
void main() {
    gl_Position = u_projMatrix * u_vmMatrix * vec4(a_position, 1.0);
}
`;

const line_fs = `
precision mediump float;
void main() {
    vec3 color = vec3(0.0, 1.0, 0.0);
    gl_FragColor = vec4(color, 1.0);
}
`;

export function initLineShader():Shader{
    let gl = App.instance().gl;
    let shader = buildShader(gl,line_vs,line_fs);
    shader.createUniforms(['u_projMatrix', 'u_vmMatrix']);
    shader.createAttribs(['a_position']);
    return shader
}
